import { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { fetchCh } from '../store/modules/channelStore';



function ReduxAsync() {
    const dispatch = useDispatch();

    const { channels } = useSelector(state => state.channels)
    useEffect(() => {
        dispatch(fetchCh())
    }, [dispatch])
    return (
        <ul>
            {channels.map((item) => (
                <li key={item.id}>{item.name}</li>
            ))}
        </ul>
    )
}

export default ReduxAsync